<!DOCTYPE html>
<html>
<head>
	<title>productAdd.html</title>

	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="this is my page">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="../../../plugins/bootstrap/css/bootstrap.min.css"
		type="text/css"></link>
	<link rel="stylesheet" href="../../../plugins/FlatUI/dist/css/flat-ui.css"
		type="text/css"></link>
	<link rel="shortcut icon" href="../../../plugins/FlatUI/dist/img/favicon.ico">
	<link rel="stylesheet" href="../../../css/style.css">
	<script type="text/javascript" src="../../../js/jquery.js"></script>
	<script src="../../../plugins/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../../plugins/FlatUI/dist/js/flat-ui.js"></script>
	<script type="text/javascript" src="../../../plugins/fwb/bootstrap-wysiwyg.js"></script>
	<script src="../../../plugins/fwb/external/jquery.hotkeys.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../../js/productAdd.js"></script>
	<script type="text/javascript" src="../../../plugins/FlatUI/dist/js/application.js"></script>
	<script type="text/javascript" src="../../../js/base.js"></script>
	 <script src="../../../js/template.js"></script>
	
	
	
<script type="text/javascript">

	$(function(){
		//加载公司数据
		$.ajax({
			url:commonurl+"/selectAllCompany.company",
			type:"POST",
			data:{
				all:"all"
			},
			dataType:"json",
			success:function(data){
				if(!data.success){
					alert('加载公司数据失败');
					return;
				}
				var obj=data.obj;
				var datas={
	            	sources:obj
	        	};
	            $("#company").html(template("companyListTemplate",datas));
	         
			}
		});
		//加载产品类型数据
		$.ajax({
			url:commonurl+"/selectAll.productType",
			type:"POST",
			data:{
				all:"all"
			},
			dataType:"json",
			success:function(data){
				if(!data.success){
					alert('加载产品类型数据失败');
					return;
				}
				var obj=data.obj;
				var datas={
	            	sources:obj
	        	};
	            $("#productType").html(template("productTypeTemplate",datas));
	         
			}
		});
		
		//加载贷款周期数据
		$.ajax({
			url:commonurl+"/selectAllPeriod.period",
			type:"POST",
			data:{
				all:"all"
			},
			dataType:"json",
			success:function(data){
				if(!data.success){
					alert('加载公司数据失败');
					return;
				}
				var obj=data.obj;
				var datas={
	            	sources:obj
	        	};
	            $("#productDuration").html(template("productDurationTemplate",datas));
	         
			}
		});
		
		
		
	    $("#addProductBtn").click(function(){
	  console.log($("#productName").val()+"###");

	        $.ajax({
	            url:commonurl+"/addproduct.product",
	            type:"POST",
	            data:{ "productName":$("#productName").val(),
	            	
	            	"minProductRate":$("#minProductRate").val(),
	            	"maxProductRate":$("#maxProductRate").val(),
	            	
	            	"company":$("#company").val(),
	            	"minLoansize":$("#minLoansize").val(),
	            	"maxLoansize":$("#maxLoansize").val(),
	            	"productType":$("#productType").val(),
	            	"productDuration":$("#productDuration").val(),
	            	"linkman":$("#linkman").val(),
	            	"bank":$("#bank").val(),
	            	"content":$("#content").text()
	            },
	            dataType:"json",
	            success:function(data){
	            	alert(data.msg);
	            	location.href="productManage.html";
	                //if(!data.success){
	                    //alert(data.msg);
	                 //   return;
	               // }
	              //  var obj = data.obj;
	             //   obj.list.forEach(function(value,index){
	                    // value.houseType=value.houseType.split(",");
	                    // value.houseState=value.houseState.split(",");
	                    // value.floorInfo=value.floorInfo.split(",");
	                    // value.updateTime=new Date(value.updateTime) ;
	                    // value.updateTime=value.updateTime.getFullYear() + "年" + (value.updateTime.getMonth() + 1) + "月" + value.updateTime.getDate() + "日 " + value.updateTime.getHours() + "点" + value.updateTime.getMinutes() + "分" + value.updateTime.getSeconds() + "秒";
	              //  })
	                // var datas={
	                //     sources:obj.list,
	                //     total:obj.total,
	                //     commonurlimg:commonurlimg
	                // };
	                // $(".houseList").html(template("detailList",datas));
	                // myPaginatorFun("myPages", obj.pageNo, obj.pages);
	            }

	        })
	    });
	})
	
	
	
	
	</script>



</head>

<body style="padding: 5px 10px">

	<div class="panel panel-primary">
	  <div class="panel-heading">
	    <h3 class="panel-title">融资产品添加</h3>
	  </div>
	  <div class="panel-body">
	  		<form class="form-horizontal" role="form" action="productManage.html">
            <div class="form-group">
              <label for="productName" class="col-lg-2 control-label">产品名称</label>
              <div class="col-lg-10">
                <input type="text" class="form-control" id="productName" placeholder="产品名称">
              </div>
            </div>
            
            <div class="form-group">
            	<label for="productRate" class="col-lg-2 control-label">贷款利率</label>
            	<div class="col-lg-10">
			        <div class="input-group col-lg-3" style="float: left;">
			            <input id="minProductRate"  type="text" class="form-control" placeholder="最低利率,不填默认为0">
			            <span class="input-group-addon">%</span>
			        </div>
			        <div style="float: left;margin: 0 10px;">-----</div>
			        <div class="input-group col-lg-4" >
			            <input  id="maxProductRate" type="text" class="form-control" placeholder="最高利率,可不填,不填认为利率为固定值">
			            <span class="input-group-addon">%</span>
			        </div>
			    </div>
          	</div>
            
            
            <div class="form-group">
              <label for="company" class="col-lg-2 control-label">发行单位</label>
              <div class="col-lg-10">
                   <select id="company" data-toggle="select" class="form-control select select-default">
                               <option value="-1">请选择</option>
                   	<script id="companyListTemplate" type="text/html">
                               <option value="-1">请选择</option>
								{{each sources as i}}
                               <option value={{i.id}}>{{i.companyName}}</option>
								
								{{/each}}
							</script>
		                
		                <!-- <option>2</option>
		                <option>3</option>
		                <option>4</option>
		                <option>5</option> -->
		              </select>
              </div>
            </div>
            
             <div class="form-group">
            	<label for="loansize" class="col-lg-2 control-label">贷款规模</label>
            	<div class="col-lg-10">
			        <div class="input-group col-lg-3" style="float: left;">
			            <input id="minLoansize" type="text" class="form-control" placeholder="最低贷款规模,不填默认为0">
			            <span class="input-group-addon">万</span>
			        </div>
			        <div style="float: left;margin: 0 10px;">-----</div>
			        <div class="input-group col-lg-5" >
			            <input id="maxLoansize" type="text" class="form-control" placeholder="最高贷款规模,可不填,不填认为贷款规模为固定值">
			            <span class="input-group-addon">万</span>
			        </div>
			    </div>
          	</div>
            
            <div class="form-group">
              <label for="productType" class="col-lg-2 control-label">产品类型</label>
              <div class="col-lg-10">
		              <select id="productType" data-toggle="select" class="form-control select select-default">
		               <option value="-1">请选择</option>
		              <script id="productTypeTemplate" type="text/html">
                              <option value="-1">请选择</option>
								{{each sources as i}}
                               <option value={{i.id}}>{{i.productTypeName}}</option>
								
								{{/each}}
							</script>
		              <!--   <option>1</option>
		                <option>2</option>
		                <option>3</option>
		                <option>4</option>
		                <option>5</option> -->
		              </select>
              </div>
            </div>
            
            <div class="form-group">
              <label for="productDuration" class="col-lg-2 control-label">贷款周期</label>
              <div class="col-lg-10">
		              <select id="productDuration" data-toggle="select" class="form-control select select-default">
		           <option value="-1">请选择</option>
		            <script id="productDurationTemplate" type="text/html">
                                <option value="-1">请选择</option>
								{{each sources as i}}
                               <option value={{i.id}}>{{i.periodName}}</option>
								
								{{/each}}
							</script>
		           
		            <!--     <option>1个月</option>
		                <option>2个月</option>
		                <option>3个月</option>
		                <option>4个月</option>
		                <option>5个月</option> -->
		              </select>
              </div>
            </div>
            
            
            <div class="form-group">
              <label for="linkman" class="col-lg-2 control-label">联系人</label>
              <div class="col-lg-10">
                <input type="text" class="form-control" id="linkman"  placeholder="联系人">
              </div>
            </div>
            
            <div class="form-group">
              <label for="bank" class="col-lg-2 control-label">联系银行</label>
              <div class="col-lg-10">
                <input type="text" class="form-control" id="bank"  placeholder="联系银行">
              </div>
            </div>
            
            <div class="form-group">
              <label for="content" class="col-lg-2 control-label">内容</label>
              <div class="col-lg-10">
              	
<!-- 			asdjalkj dlkajsdkl asjdlkaj sdkl asd -->
			<div class="btn-toolbar" data-role="editor-toolbar"	data-target="#content">
				<div class="btn-group">
					<a class="btn" data-edit="bold" title="Bold (Ctrl/Cmd+B)">
						<b>加粗</b>
					</a> 
					<a class="btn" data-edit="italic" title="Italic (Ctrl/Cmd+I)">
						<i>倾斜</i>
					</a> 
				</div>
				<div class="btn-group">
					<a class="btn" data-edit="insertunorderedlist" title="Bullet list">
						列表
					</a>
					<a class="btn" data-edit="insertorderedlist" title="Number list">
						有序列表
					</a> 
					<a class="btn" data-edit="indent" title="Indent (Tab)">
						Tab缩进
					</a>
				</div>
				<div class="btn-group">
					<a class="btn" data-edit="justifyleft"
						title="Align Left (Ctrl/Cmd+L)">
						左对齐
					</a> 
					<a class="btn" data-edit="justifycenter" title="Center (Ctrl/Cmd+E)">
						居中
					</a> 
					<a class="btn" data-edit="justifyright"
						title="Align Right (Ctrl/Cmd+R)">
						右对齐
					</a> 
					<a class="btn" data-edit="justifyfull" title="Justify (Ctrl/Cmd+J)">
						自动调整
					</a>
				</div>
		
		 		<div class="btn-group">
					<a class="btn" data-edit="undo" title="Undo (Ctrl/Cmd+Z)">
						撤销
					</a> 
					<a class="btn" data-edit="redo" title="Redo (Ctrl/Cmd+Y)">
						恢复
					</a>
				</div>
				
			</div>
<!--               	asdalksdjklasj -->
              	
            <div id="content" style="overflow:scroll; max-height:300px;border: 1px solid;height: 200px;"></div>
         </div>
     </div>
            
            
            
            <div class="form-group">
              <div class="col-lg-offset-2 col-lg-10">
               <button  id="addProductBtn" type="button" class="btn btn-lg btn-success" style="padding: 15px 60px;border-radius: 0px;">添加</button>
              </div>
            </div>
          </form>
	  		
	  		
	  		
	  </div>
	</div>
	
</body>
</html>
